<template>
  <u-popup v-model="show" mode="bottom" border-radius="14" @maskClick="_close">
    <view class="morePopup safe-bottom">
      <view class="justify-between headTitle">
        <view></view>
        <view class="fz-16">分享给朋友</view>
        <view @click="_close"><u-icon name="close" size="32" /></view>
      </view>
      <view class="u-flex pa32">
        <!-- 微信 -->
        <view style="width: 130rpx" class="tc" @click="openShare(2)">
          <view class="shareBox" style="background: #07c160">
            <i
              class="iconfont icon-weixin"
              style="font-size: 50rpx; color: #fff"
            />
          </view>
          <view class="u-p-t-10 fz-10">微信</view>
        </view>
        <!-- 朋友圈海报 --> 
        <view style="width: 130rpx" class="tc" @click="openShare(3)">
          <view class="shareBox" style="background: #ff7500">
            <i
              class="iconfont icon-pengyouquan"
              style="font-size: 50rpx; color: #fff"
            />
          </view>
          <view class="u-p-t-10 fz-10">朋友圈海报</view>
        </view>
      </view>
      <scroll-view scroll-x class="pa32">
        <!-- 订单管理 -->
        <!-- <view style="width: 130rpx" class="tc disIn" @click="_goOrder">
          <view class="shareBox" style="background: #FABE0C">
            <i
              class="iconfont icon-order"
              style="font-size: 40rpx; color: #fff"
            />
          </view>
          <view class="u-p-t-10 fz-10">订单管理</view>
        </view> -->
        <!-- 邀请帮卖 --> 
        <view style="width: 130rpx" class="tc disIn" v-if="item.isCanInvite === 1 && item.isGroup === 2" @click="clickBestead(2)">
          <view class="shareBox" style="background: #FABE0C">
            <i
              class="iconfont icon-invite"
              style="font-size: 44rpx; color: #fff"
            />
          </view>
          <view class="u-p-t-10 fz-10">邀请帮卖</view>
        </view>
        <!-- 修改 --> 
        <view style="width: 130rpx" class="tc disIn" @click.stop="editorHelpSellfn">
          <view class="shareBox" style="background: #FABE0C">
            <i
              class="iconfont icon-edit"
              style="font-size: 40rpx; color: #fff"
            />
          </view>
          <view class="u-p-t-10 fz-10">修改</view>
        </view>
        <!-- 隐藏该团 -->
        <view style="width: 130rpx" class="tc disIn" v-if="item.openStatus === 1" @click="switchHide(2)">
          <view class="shareBox" style="background: #F2F3F5">
            <i
              class="iconfont icon-hind"
              style="font-size: 40rpx; color: #323233"
            />
          </view>
          <view class="u-p-t-10 fz-10">{{item.isGroup === 2 ? '隐藏该团' : '隐藏'}}</view>
        </view>
        <!-- 显示该团 -->
        <view style="width: 130rpx" class="tc disIn" v-if="item.openStatus === 2" @click="switchHide(1)">
          <view class="shareBox" style="background: #F2F3F5">
            <i
              class="iconfont icon-show"
              style="font-size: 40rpx; color: #323233"
            />
          </view>
          <view class="u-p-t-10 fz-10">{{item.isGroup === 2 ? '显示该团' : '显示'}}</view>
        </view>
        <!-- 删除 -->
        <view style="width: 130rpx" class="tc disIn" @click="removeDynamic">
          <view class="shareBox" style="background: #F2F3F5">
            <i
              class="iconfont icon-delete"
              style="font-size: 40rpx; color: #323233"
            />
          </view>
          <view class="u-p-t-10 fz-10">删除</view>
        </view>
        <!-- 结束该团 -->
        <!-- <view style="width: 130rpx" class="tc disIn" v-if="goodsEndTiem && item.isGroup === 2" @click="dynamicStatus(1)">
          <view class="shareBox" style="background: #F2F3F5">
            <i
              class="iconfont icon-off"
              style="font-size: 40rpx; color: #323233"
            />
          </view>
          <view class="u-p-t-10 fz-10">结束该团</view>
        </view> -->
        <!-- 重启该团 -->
        <!-- <view style="width: 130rpx" class="tc disIn"  v-if="!goodsEndTiem && item.isGroup === 2" @click="dynamicStatus(2)">
          <view class="shareBox" style="background: #F2F3F5">
            <i
              class="iconfont icon-reboot_color"
              style="font-size: 40rpx; color: #323233"
            />
          </view>
          <view class="u-p-t-10 fz-10">重启该团</view>
        </view> -->
        <!-- 置顶 -->
        <view style="width: 130rpx" class="tc disIn" v-if="item.isUserTop === 0" @click="isTop(1)" >
          <view class="shareBox" style="background: #F2F3F5">
            <i
              class="iconfont icon-top"
              style="font-size: 40rpx; color: #323233"
            />
          </view>
          <view class="u-p-t-10 fz-10">置顶</view>
        </view>
        <!-- 取消置顶 -->
        <view style="width: 130rpx" class="tc disIn" v-if="item.isUserTop === 1" @click="isTop(0)">
          <view class="shareBox" style="background: #F2F3F5">
            <i
              class="iconfont icon-canceltop_color"
              style="font-size: 40rpx; color: #323233"
            />
          </view>
          <view class="u-p-t-10 fz-10">取消置顶</view>
        </view>
      </scroll-view>
    </view>
  </u-popup>
</template>

<script>
export default {
  props: {
    show: {
      type: Boolean,
      default: false,
    },
    item: {
      type: Object,
      default: {}
    },
    // 结束时间
    // goodsEndTiem: {
    //   type: String,
    //   default: ''
    // },
    routeData: {
      type: Object,
      default: {}
    }
  },
  methods:{
    // 打开分享
    openShare(type){
      this.$emit('openShare',type)
    },
    // 跳转去订单列表
    _goOrder(){
      this._close()
      this.navigateTo({url: '/pages/order/index'});
    },
    // 帮卖
    clickBestead(type){
      this.$emit('clickBestead',type)
    },
    // 隐藏显示该团
    switchHide(type){
      this.$emit('switchHide',type)
    },
    // 删除动态
    removeDynamic(){
      this.$emit('removeDynamic')
    },
    // 结束或者重启该团
    // dynamicStatus(type){
    //   this.$emit('dynamicStatus',type)
    // },
    isTop(type){
      this.$emit('isTop',type)
    },
    // 编辑团
    editorHelpSellfn() {
      if(this.routeData.headAccountId){// 我的-分销管理-帮卖社群-帮卖的团
        this.navigateTo({url: `/pagesA/release/issueEdit?dynamicId=${this.item.dynamicId}&operateType=1&headAccountId=${this.routeData.headAccountId}&pageType=${this.item.isGroup}`});
      }else if(this.routeData.groupAccountId){// 我的-分销管理-供货社群-可帮卖的团
        this.navigateTo({url: `/pagesA/release/issueEdit?dynamicId=${this.item.dynamicId}&operateType=1&groupAccountId=${this.routeData.groupAccountId}&pageType=${this.item.isGroup}`});
      }else if(this.routeData.type == 3 || this.routeData.accountId){// 为社群主页进入
        this.navigateTo({url: `/pagesA/release/issueEdit?dynamicId=${this.item.dynamicId}&operateType=1&accountId=${this.routeData.accountId}&videoType=3&pageType=${this.item.isGroup}`});
      }else if(this.routeData.type == 2 || this.routeData.shareType){//  为分享进入
        this.navigateTo({url: `/pagesA/release/issueEdit?dynamicId=${this.item.dynamicId}&operateType=1&videoType=2&pageType=${this.item.isGroup}`});
      }else{// 调取首页视频流接口
        this.navigateTo({url: `/pagesA/release/issueEdit?dynamicId=${this.item.dynamicId}&operateType=1&pageType=${this.item.isGroup}`});
      }
    },
    // 关闭弹窗
    _close(){
      this.$emit('close')
    }
  }
};
</script>
<style lang="scss" scoped>
.morePopup {
  overflow:hidden;
  white-space:nowrap;
  .headTitle {
    line-height: 96rpx;
    box-shadow: inset 0px -1px 0px #eeeeee;
    padding: 0 32rpx;
  }
  .pa32 {
    padding: 32rpx;
  }
  .tc{
    flex-shrink: 0;
  }
  .disIn{
    display: inline-block;
  }
  .scrollOperate{
    position: relative;
    display: flex;
    width: auto !important;
  }
  .shareBox {
    width: 80rpx;
    height: 80rpx;
    line-height: 80rpx;
    border-radius: 80rpx;
    text-align: center;
    margin: 0 auto;
  }
}
</style>